package util;

import org.springframework.beans.factory.config.Scope;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.AbstractRefreshableApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.context.request.SessionScope;

public class SpringUtils {
	
	private static ApplicationContext context = new ClassPathXmlApplicationContext(new
			String[]{"applicationContext.xml"});
	
	public static ApplicationContext getApplicationContext(){
		
		ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) context;
		ctx.getBeanFactory().registerScope("session", new SessionScope());
		
		return context;	
	}

}
